<script setup lang="ts">
import { DictEnum } from '@vben/constants';

import { Descriptions, DescriptionsItem } from 'ant-design-vue';

import { renderDict } from '#/utils/render';

defineProps<{
  data?: any;
}>();
</script>

<template>
  <div>
    <Descriptions :column="1" size="small" bordered>
      <DescriptionsItem label="订阅类型">
        {{ data ? 'mqtt' : '---' }}
      </DescriptionsItem>
      <DescriptionsItem label="订阅消息">
        <template v-if="data">
          <component
            :is="renderDict(data.messageType, DictEnum.IOT_TOPIC_TYPE)"
          />
        </template>
        <template v-else> --- </template>
      </DescriptionsItem>
      <DescriptionsItem label="创建时间">
        {{ data?.createTime || '---' }}
      </DescriptionsItem>
    </Descriptions>
  </div>
</template>
